package day06;
//数组的演示
import java.util.Arrays;
public class ArrayDemo {
    public static void main(String[] args) {
        //6）  数组的复制


        /*
        int[] a ={10,20,30,40,50};
        int[] b =new int[6];
        //a:源数组
        //1：源数组的起始下标
        //b:目标数组
        //0：目标数组的起始下标
        //4：要复制的元素个数
        System.arraycopy(a,1,b,0,4); //灵活性更好
        for (int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }



        int[] a ={10,20,30,40,50};
        int[] b = Arrays.copyOf(a,8);
        for (int i=0;i<b.length;i++){
            System.out.println(b[i]);
        }

         */



        int[] a = {10,20,30,40,50};
        Arrays.copyOf(a,a.length-1);
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }








    }
}
